<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of triangulateFaces</title>
  <meta name="keywords" content="triangulateFaces">
  <meta name="description" content="TRIANGULATEFACES  convert face array to an array of triangular faces">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="#">imael</a> &gt; <a href="#">geom3d</a> &gt; triangulateFaces.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for .\imael\geom3d&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>triangulateFaces
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>TRIANGULATEFACES  convert face array to an array of triangular faces</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function tri = triangulateFaces(faces) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">TRIANGULATEFACES  convert face array to an array of triangular faces 

   TRI = triangulateFaces(FACES)
   Returns a 3-columns array of indices, based on the data stored in the
   argument FACES:
   - if FACES is a N-by-3 array, returns the same array
   - if FACES is a N-by-4 array, returns an array with 2*N rows and 3
       columns, splitting each square into 2 triangles (uses first and
       third vertex of each square as diagonal).
   - if FACES is a cell array, split each face into a set of triangles,
       and returns the union of all triangles. Faces are supposed to be
       convex.

   Example
   % create a basic shape
   [n e f] = createCubeOctahedron;
   % draw with plain faces
   figure;drawPolyhedron(n, f);
   % draw as a triangulation
   tri = triangulateFaces(f);
   figure;patch('vertices', n, 'faces', tri, 'facecolor', 'r');

   See also
   <a href="polyhedra.html" class="code" title="function polyhedra(varargin)">polyhedra</a>, <a href="drawPolyhedron.html" class="code" title="function varargout = drawPolyhedron(nodes, faces, varargin)">drawPolyhedron</a>

 ------
 Author: David Legland
 e-mail: david.legland@nantes.inra.fr
 Created: 2008-09-08,    using Matlab 7.4.0.287 (R2007a)
 Copyright 2008 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
<!-- crossreference -->



<hr><address>Generated on Fri 05-Feb-2010 11:20:41 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>